
import request from '@/utils/request'


export function getFields() {
  return request({
    method: 'GET',
    url: '/mutual-content/templateEnum/page',
    params: {
      page: 1,
      size: 200
    }
  })
}

/**
 * @description: 新建模板，该方法会返回新建模板的id
 * @param {Object} template
 */
export function addTemplate(template) {
  return request({
    method: 'put',
    url: '/mutual-content/template',
    data: template
  })
}

export function updateTemplate(template) {
  return request({
    method: 'post',
    url: '/mutual-content/template',
    data: template
  })
}

/**
 * @description: 新增多个字段
 * @param {Array}list 要增加的字段Object组成的数组
 */
export function addTemplateDetail(list) {
  return request({
    method: 'put',
    url: '/mutual-content/templateDetail',
    data: list
  })
}


/**
 * @description: 更新多个字段的设置
 * @param {Array}list 要更新的字段Object组成的数组
 */
export function updateTemplateDetail(list) {
  return request({
    method: 'post',
    url: '/mutual-content/templateDetail',
    data: list
  })
}


/**
 * @description: 传入多个要删除的字段id，删除字段
 * @param {Array} list 要删除的字段id拼接成的String :a,b,c
 */
export function delTemplateDetail(list) {
  return request({
    method: 'delete',
    url: '/mutual-content/templateDetail',
    data: list
  })
}